var express = require('express');
var router = express.Router();
/* GET users listing. */
var str = "";
var soap = require('soap');
// var url = 'http://localhost:8080/test/user?wsdl';
router.get('/soapiest', function(req, res){
    res.send('hello world');
});
router.get('/soapiest', function (req, res, next) {
    //使用soap，根据wsdl地址创建客户端
    var url = req.body.wsdlurl;
    var canshu = req.body.canshu;
    soap.createClient(url, canshu, function (err, client) {
        if (err) {
            console.log(err);
        }
        //返回一个客户端，并且传参调用Java的接口，接收返回的数据'411001'

        client.getUser({arg0: canshu}, function (error, result) {
            //打印接收到的数据
            console.log(result);
            str = result.toString();
        });
    });
    res.send("返回内容：" + str);
    res.render('queryCard', {title: 'Express'});
});

module.exports = router;
